import 'package:banyou_app/app/config/colors.dart';
import 'package:banyou_app/app/routes/app_pages.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';

class ServiceTermsWidget extends StatelessWidget {
  const ServiceTermsWidget();

  @override
  Widget build(BuildContext context) {
    return Container(
      child: SingleChildScrollView(
        child: Container(
          color: ColorConfig.white,
          child: Column(
            children: [
              SizedBox(height: 2),
              Image.asset('assets/images/UM@2x.png', width: 100),
              SizedBox(height: 10),
              Container(
                padding: EdgeInsets.only(top: 14.h, bottom: 16.h),
                child: Text(
                  '服务协议和隐私政策',
                  style: TextStyle(
                      color: ColorConfig.text_label,
                      fontSize: 18.sp,
                      fontWeight: FontWeight.bold),
                ),
              ),
              Container(
                  padding:
                      EdgeInsets.only(bottom: 27.h, left: 20.w, right: 20.w),
                  child: RichText(
                    text: TextSpan(children: [
                      TextSpan(
                          text: '感谢您选择我们的APP!',
                          style: TextStyle(
                              fontSize: 16.0.sp,
                              color: ColorConfig.text_label)),
                    ]),
                  )),
              Container(
                padding: EdgeInsets.symmetric(horizontal: 20.w),
                child: RichText(
                    text: TextSpan(
                  children: [
                    TextSpan(
                        text:
                            '我们非常重视您的个人信息和隐私保护为了更好地保障您的个人权益，在您使用我们的产品前，请务必审慎阅读',
                        style: TextStyle(
                            fontSize: 14.0.sp, color: Color(0xFF666666))),
                    TextSpan(
                        text: '《用户协议》',
                        recognizer: TapGestureRecognizer()
                          ..onTap = () {
                            Get.toNamed(Routes.WEB, arguments: {
                              "title": '用户协议',
                              "url":
                                  'https://aqcdn.olbibo.com.cn/Static/UserAgreement.html',
                            });
                          },
                        style: TextStyle(
                            fontSize: 14.sp, color: ColorConfig.app_main)),
                    TextSpan(
                        text: '和',
                        style: TextStyle(
                            fontSize: 14.0.sp, color: Color(0xFF666666))),
                    TextSpan(
                        text: '《隐私政策》',
                        recognizer: TapGestureRecognizer()
                          ..onTap = () {
                            Get.toNamed(Routes.WEB, arguments: {
                              "title": '隐私政策',
                              "url":
                                  'https://aqcdn.olbibo.com.cn/Static/PrivacyPolicy.html',
                            });
                          },
                        style: TextStyle(
                            fontSize: 13.sp, color: ColorConfig.app_main)),
                    TextSpan(
                        text:
                            '内的所有条款，尤其是:\n1.我们对您的个人信息的收集/保存/使用/对外提供/保护等规则条款，以及您的用户权利等条款\n2.约定我们的限制责任、免责条款。您点击“同意”的行为即表示您已阅读完毕并同意以上协议的全部内容',
                        style: TextStyle(
                            fontSize: 14.0.sp, color: Color(0xFF666666))),
                  ],
                  style: TextStyle(
                    color: ColorConfig.subtitle_text,
                    fontSize: 13.sp,
                  ),
                )),
              ),

              Container(
                padding: EdgeInsets.only(top: 30.h, bottom: 36.h),
                margin: EdgeInsets.symmetric(horizontal: 15.w),
                child: Row(
                  children: [
                    Expanded(
                      child: Container(
                        height: 45,
                        child: ElevatedButton(
                          style: ElevatedButton.styleFrom(
                              primary: Color(0xFFEDEDED),
                              shape: RoundedRectangleBorder(
                                borderRadius: BorderRadius.circular(22.5),
                              )),
                          onPressed: () {
                            Get.back(result: 0);
                          },
                          child: Text('暂不同意',
                              style: TextStyle(
                                  fontSize: 17.sp,
                                  color: Color(0xFF999990),
                                  fontWeight: FontWeight.w400)),
                        ),
                      ),
                    ),
                    SizedBox(
                      width: 21.w,
                    ),
                    Expanded(
                      child: InkWell(
                        onTap: () {
                          Get.back(result: 1);
                        },
                        child: Container(
                          height: 45,
                          alignment: Alignment.center,
                          decoration: BoxDecoration(
                            gradient: LinearGradient(
                                begin: Alignment.centerLeft,
                                end: Alignment.centerRight,
                                colors: [
                                  Color(0xFFF52EC5),
                                  Color(0xFFFF8A33),
                                ]),
                            borderRadius: BorderRadius.circular(20),
                          ),
                          child: Text('同意并接受',
                              style: TextStyle(
                                  fontSize: 17.sp,
                                  color: ColorConfig.white,
                                  fontWeight: FontWeight.w400)),
                        ),
                      ),
                    ),
                  ],
                ),
              )
              // TextButton(
              //     onPressed: () {
              //       Get.back(result: 0);
              //     },
              //     child: Text('不同意并退出',
              //         style: TextStyle(
              //             fontSize: 14.sp,
              //             color: ColorConfig.white,
              //             fontFamily: 'mononoki')))
            ],
          ),
        ),
      ),
    );
  }
}
